﻿using System;
using MCP.BL.Messages;

namespace MCP.BL
{
    /// <summary>
    /// Operation result is using when user need to be informed about some operation results, for example: successful adding or updating new data to db.
    /// </summary>
    public class OperationResult : OperationResultBase
    {
        #region Constructor

        public OperationResult(bool success, params MessageBase[] messages)
            : base(success, null, messages)
        {
        }

        public OperationResult(Exception exc, params MessageBase[] messages)
            : base(false, exc, messages)
        {
        }

        #endregion
        
        ///// <summary>
        ///// Creates objectless OperationResult with messages.
        ///// </summary>
        ///// <param name="success">Success status.</param>
        ///// <param name="messages">Messages to attach to OperationResult.</param>
        //public static OperationResult GetSuccessfulResult(params MessageBase[] messages)
        //{
        //    return new OperationResult(true, null, messages);
        //}

        ///// <summary>
        ///// Creates failed OperationResult based upon some messages.
        ///// </summary>
        ///// <param name="messages">Messages to return.</param>
        ///// <returns>Failed OperationResult.</returns>
        //public static OperationResult GetFailedResult(params MessageBase[] messages)
        //{
        //    return new OperationResult(false, null, messages);
        //}

        ///// <summary>
        ///// Creates failed OperationResult.
        ///// </summary>
        ///// <param name="exc">Exception occured during operation execution.</param>
        //public static OperationResult GetFailedResult(Exception exc, params MessageBase[] messages)
        //{
        //    return new OperationResult(false, exc, new MessagePool(messages, exc));
        //}
    }
}